package com.guigu.eduservice.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guigu.common.utils.R;
import com.guigu.eduservice.entity.Advertisement;
import com.guigu.eduservice.service.AdvertisementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 广告表（管理PC端和小程序端的广告展示） 前端控制器
 * </p>
 *
 * @author Xiaosong
 * @since 2025-09-28
 */
@RestController
@RequestMapping("/advertisement")
public class AdvertisementController {
    @Autowired private AdvertisementService advertisementService;
    //轮播图列表
    @GetMapping("advertisementlist")
    public R index(){
        System.out.println("进入广告页面");
        QueryWrapper<Advertisement> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("ad_type",1);
        List<Advertisement> list = advertisementService.list(queryWrapper);
        System.out.println(list);
        return R.ok().data("list",list);
    }
}
